From: Carlos Garnacho Date: Sun, 27 Nov 2022 12:06:40 +0000 (+0100) Subject: gtktext: Claim drag gesture after an actual selection change X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~9^2~65^2~4 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=76d80f75444d95540da0d472c7e5aea8a74bf218;p=gtk4.git gtktext: Claim drag gesture after an actual selection change This way, the drag gesture lets the click gesture ::release handler happen if there was no actual changes to the selected text (i.e. too short drags). This matches the ::release handler behavior match the situations in which the OSK was being invoked by the wayland GtkIMContext. --- diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 39eda89baa..e58355e403 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -3051,8 +3051,7 @@ gtk_text_drag_gesture_update (GtkGestureDrag *gesture, GdkDevice *source; guint length; int tmp_pos; - - gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED); + int pos, bound; length = gtk_entry_buffer_get_length (get_buffer (self)); @@ -3070,7 +3069,6 @@ gtk_text_drag_gesture_update (GtkGestureDrag *gesture, { int min, max; int old_min, old_max; - int pos, bound; min = gtk_text_move_backward_word (self, tmp_pos, TRUE); max = gtk_text_move_forward_word (self, tmp_pos, TRUE); @@ -3101,11 +3099,17 @@ gtk_text_drag_gesture_update (GtkGestureDrag *gesture, if (priv->current_pos != max) pos = min; } - - gtk_text_set_positions (self, pos, bound); } else - gtk_text_set_positions (self, tmp_pos, -1); + { + pos = tmp_pos; + bound = -1; + } + + if (pos != priv->current_pos) + gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED); + + gtk_text_set_positions (self, pos, bound); /* Update touch handles' position */ if (gtk_simulate_touchscreen () ||